<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=\, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    h3,
    p {
      margin: 0;
    }
    .layout {
      width: 300px;
      height: 200px;
      position: relative;
    }
    .layout img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .content {
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      background-color: rgba(0, 0, 0, 0.5);
      /* clip-path: inset(50% 50% 50% 50%); */

      /* 从四个角到中间 */
      /* clip-path: inset(50%); */

      /* 从上往下 */
      clip-path: inset(0 0 100% 0);

      transition: clip-path 0.5s;
      color: #fff;
      /* 弹性布局 */
      display: flex;
      /* 主轴为垂直方向 */
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 0px 20px;
      text-align: center;
    }
    .content h3 {
      margin-bottom: 10px;
    }
  
    /* 鼠标移入效果 */
    .layout:hover .content {
      clip-path: inset(0);
    }
  </style>
<body>
    <div class="layout">
        <img src="/src/img/css3/ms.jpg" alt="美食" />
        <div class="content">
          <h3>巨诺西大魔芋低凉皮凉面</h3>
          <p>配料：面、胡萝卜、西蓝花、黄瓜、玉米、虾</p>
        </div>
      </div>
</body>
</html>